﻿/*
* 创建者：LIYINFAI
* 创建时间：2024/01/25 11:40:00
* 描述：
* --------------------------------------
* 修改说明：
* --------------------------------------
*/
using CommonLibrary.Forms;
using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace CommonLibrary
{
    /// <summary>
    /// 报警信息管理窗体
    /// </summary>
    public partial class FormDataType : HWFrmWithTitle
    {
        /// <summary>
        /// 选择的数据类型
        /// </summary>
        public EDataType SelectedDataType = EDataType.SHORT;
        /// <summary>
        /// 构造函数
        /// </summary>
        public FormDataType()
        {
            InitializeComponent();
        }
        private void FormDataType_Load(object sender, EventArgs e)
        {
            Init();
        }
        private void Init()
        {
            this.comboBoxDataType.Items.Clear();
            this.comboBoxDataType.Items.AddRange(Enum.GetNames(typeof(EDataType)));
            this.comboBoxDataType.SelectedIndex = 0;
        }
        private void FormDataType_Shown(object sender, EventArgs e)
        {
        }
        private void FormDataType_FormClosing(object sender, FormClosingEventArgs e)
        {
        }

        private void buttonSave_Click(object sender, EventArgs e)
        {
            var selectedItem = this.comboBoxDataType.SelectedItem.ToString();
            this.SelectedDataType = CommonHelper.GetEnumByName(selectedItem, EDataType.SHORT);
            this.Close();
        }
    }
}
